//
//  FloatingPlayerView.m
//  F FloatingPlayer
//
//  Created by yonas on 2018/9/26.
//  Copyright © 2018年 Inspur. All rights reserved.
//

#import "FloatingView.h"
#import "FloatingViewModel.h"
@interface FloatingView()
@property(nonatomic,weak) FloatingViewModel *playerModel;
@end

@implementation FloatingView
- (instancetype)initWithPlayerModel:(FloatingViewModel *)playerModel{
    if (self = [super init]){
        _playerModel = playerModel;
        [self _defaultSettings];
    }
    return self;
}
- (void)_defaultSettings{
    self.frame = CGRectMake(0, 0, _playerModel.originalFrame.size.width, _playerModel.originalFrame.size.height);
    
    if (_playerModel.willShowLayer){
        //默认填充。
        _playerModel.willShowLayer.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
        [self.layer addSublayer:_playerModel.willShowLayer];
    }
    if (_playerModel.willShowView){
        //默认填充。
        _playerModel.willShowView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
        [self addSubview:_playerModel.willShowView];
    }
}
- (void)dealloc{
    NSLog(@"%s",__func__);
}
@end
